<template>
  <div class="pagss">
    <Navv></Navv>

    <el-row :gutter="20">

      <el-col :span="4">
        <!-- 侧边导航++++++++++++++++++++++ -->
        <Sidebar defaultActive='5-2'></Sidebar>
        <!-- 侧边导航=============== -->
      </el-col>

      <el-col :span="20">
        <div class="panel-group1">
          <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">

            <el-form-item style="width: 300px;" label="真实姓名" prop="real_name">
              <el-input v-model="ruleForm.real_name" :disabled="true"></el-input>
            </el-form-item>

            <el-form-item style="width: 300px;" label="提现银行：" prop="bank">
              <div class=" space-between center yhbox">

                <div>
                  <img style="width: 20px;height: 20px;" src="@/assets/images/yy.png" />
                </div>




                <div class="column center">
                  <div class="row center">
                    <div class="row center">
                      <img style="width: 40px;height: 40px;" :src="ruleForm.open_bank_log" />
                    </div>

                    <div class="column ml_10">
                      <div class="f_16 f_bold" style="line-height: 16px;letter-spacing:11px">{{ruleForm.open_bank}}
                      </div>
                      <div class="" style="width: 146px;line-height: 12px;margin-top: 5px;font-size: 8px;">
                        {{ruleForm.open_bank_e}}
                      </div>
                    </div>
                  </div>

                  <div class="f_bold"> {{ruleForm.card_number}}</div>
                </div>
                <div>
                  <!-- <i class="el-icon-arrow-down"></i> -->
                </div>
              </div>
            </el-form-item>



            <el-form-item style="width: 300px;" label="安全密码:" prop="safe_password">
              <div class="row_a_c">
                <el-input show-password v-model="ruleForm.safe_password"></el-input>
                <div style="width: 60px;margin-left: 18px;" class="color_1A82FB f_14 cursor" @click="updateSafePassword(ruleForm.id)">
                  修改</div>
              </div>
            </el-form-item>

          </el-form>
        </div>
      </el-col>
    </el-row>

  </div>
</template>

<script>
  import CountTo from 'vue-count-to'
  import Cookies from 'js-cookie'
  import Vue from 'vue';
  import Navv from "@/components/Navv";
  import Sidebar from "@/components/Sidebar";
  import * as User from "@/api/system/user";

  export default {
    name: 'Index',
    components: {
      CountTo,
      Navv,
      Sidebar


    },
    data() {
      return {

        ruleForm: {
          safe_password: '',

        },
        rules: {
          safe_password: [{
            required: true,
            message: '请输入姓名',
            trigger: 'blur'
          }, ],

        }



      }
    },
    created() {
      this.getUserBank(); //查询用户银行卡
    },
    mounted() {

    },
    methods: {

      /**修改安全密码*/
      updateSafePassword(id) {
        var per = {
          id: id,
          safe_password: this.ruleForm.safe_password

        }

        User.updateSafePassword(per).then((data) => {
          this.$modal.msgSuccess("修改成功");
          //处理成功后的逻辑
          console.log(data); //这个data 是接收的resolve参数--
        }).catch((err) => {
          console.log(err);
        })
      },



      /**查询用户银行卡 */
      getUserBank() {

        this.loading = true;
        User.getUserBank().then(response => {
          // this.ruleForm.open_bank_class_id = response.data.class_id
          // this.ruleForm.card_number = response.data.card_number
          this.ruleForm = response.data
          console.log('银行卡', response.data)
          this.loading = false;
        });
      },






    }
  }
</script>

<style lang="scss" scoped>
  .pagss {
    height: 100%;
    background: #f4f6f9;
    // padding: 5px 0 15px 40px;
  }

  .panel-group1 {
    padding: 25px;
    margin-top: 18px;
    margin-bottom: 0px;
    margin-right: 15px;
    min-height: 760px;
    background: #FFFFFF;
    border-radius: 10px 10px 10px 10px;
    opacity: 1;
  }

  .tximg {
    width: 150px;
    height: 150px;
    background: #FFFFFF;
    border-radius: 4px 4px 4px 4px;
    opacity: 1;
    border: 1px solid #BBBBBB;
  }

  .yhbox {
    padding: 20px;
    width: 320px;
    height: 120px;
    background: #FFFFFF;
    // background: red;
    border-radius: 4px 4px 4px 4px;
    opacity: 1;
    border: 1px solid #BBBBBB;
  }
</style>
